package com.D5Power.Objects
{
	import com.D5Power.Controler.BaseControler;
	import com.D5Power.basic.ResourcePool;
	
	/**
	 * 由电脑控制的玩家对象
	 */ 
	public class NCharacterObject extends CharacterObject implements IPoolObject
	{
		/**
		 * 用户ID，如果为0则为NPC
		 */ 
		protected var _uid:uint=0;

		public function set uid(val:uint):void
		{
			canBeAtk=val>0;
			_uid=val;
		}
		
		public function get uid():uint
		{
			return _uid;
		}
		
		public function NCharacterObject(ctrl:BaseControler=null)
		{
			super(ctrl);
			objectName = 'NCharacterObject';
			_directionNum = 4;
		}
		
		public function close():void
		{
			if(!inuse) return;
			_controler.perception.Scene.removeObject(this);
			inuse = false;
			_graphics = null;
			render = null;
			canBeAtk = false;
			_qTree = null;
			_controler = null;
		}
		
		public function open(_controller:BaseControler):void
		{
			if(inuse)
			{
				trace("This object is in use,can not be reopen.");
				return;
			}
			inuse = true;
			_controler = _controller;
			_controler.perception.Scene.addObject(this);
		}
	}
}